package tools;

import org.junit.Test;
import org.sqids.Sqids;

import java.util.Arrays;
import java.util.List;

public class SqIdsDemo {

    /**
     */
    public static void main(String[] args) {
        Sqids sqids=Sqids.builder()
                .minLength(10)
                .build();
        String id=sqids.encode(Arrays.asList(1L,2L,3L)); // "86Rf07xd4z"
        System.out.println("id:"+ id);
        List<Long> numbers=sqids.decode(id); // [1, 2, 3]
        System.out.println(numbers);
    }

    @Test
    public void t1(){
        Sqids sqids=Sqids.builder()
                .alphabet("FxnXM1kBN6cuhsAvjW3Co7l2RePyY8DwaU04Tzt9fHQrqSVKdpimLGIJOgb5ZE")
                .build();
        String id=sqids.encode(Arrays.asList(1L,2L,3L)); // "B4aajs"
        System.out.println("加密后="+ id);
        List<Long> numbers=sqids.decode(id); // [1, 2, 3]
        System.out.println(numbers);
    }

}
